import React, { Component } from 'react';

class User extends Component {
  constructor() {
    super();
    this.state = {}
  }
  render() {
    console.log(this.props);
    return (
      <div>
        <p>user：我是子组件，也是UI型组件，数据和逻辑来自父组件</p>
        <p>{this.props.info1.age}</p>
        <p>{this.props.info1.name}</p>
        <hr />
        <p>name:{this.props.name}</p>
        <p>age:{this.props.age}</p>
        <button onClick={()=>this.props.changeAge(60)}>我要退休</button>
        <button onClick={()=>this.props.changeName('Mabaoguo')}>我要改名</button>
      </div>
    );
  }
}

export default User;
